import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    subjects:[]
  },
  mutations: {
    getAllSubjectsMutations(state,payload){
      state.subjects=payload
    }
  },
  actions: {
    async getAllSubjectsAsync(cxt){
      const {data:{result}}=await Vue.prototype.$api.subjects.getSubjects()
      cxt.commit('getAllSubjectsMutations',result)
    }
  }
})
